﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

using alib.Debugging;


namespace agree.itsdb.table
{
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	///
	/// Itsdb table types follow 
	///
	///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

	public class Item : TsdbTable<entity.Item>
	{
		public Item(TsdbDatabase db) : base(db) { }

		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		public Dictionary<int, entity.Item> _i_id_map = new Dictionary<int, entity.Item>();

		[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
		public new entity.Item[] _items_display { get { return this.ToArray(); } }
	};

	public class Analysis : TsdbTable<entity.Analysis>
	{
		public Analysis(TsdbDatabase db) : base(db) { }

	};

	public class Phenomenon : TsdbTable<entity.Phenomenon>
	{
		public Phenomenon(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Phenomenon> _p_id_map = new Dictionary<int, entity.Phenomenon>();
	};

	public class Parameter : TsdbTable<entity.Parameter>
	{
		public Parameter(TsdbDatabase db) : base(db) { }

	};

	public class Set : TsdbTable<entity.Set>
	{
		public Set(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Set> _s_id_map = new Dictionary<int, entity.Set>();
	};

	public class Item_Phenomenon : TsdbTable<entity.Item_Phenomenon>
	{
		public Item_Phenomenon(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Item_Phenomenon> _ip_id_map = new Dictionary<int, entity.Item_Phenomenon>();
	};

	public class Item_Set : TsdbTable<entity.Item_Set>
	{
		public Item_Set(TsdbDatabase db) : base(db) { }

	};

	public class Run : TsdbTable<entity.Run>
	{
		public Run(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Run> _run_id_map = new Dictionary<int, entity.Run>();
	};

	public class Parse : TsdbTable<entity.Parse>
	{
		public Parse(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Parse> _parse_id_map = new Dictionary<int, entity.Parse>();
	};

	public class Result : TsdbTable<entity.Result>
	{
		public Result(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Result> _result_id_map = new Dictionary<int, entity.Result>();
	};

	public class Rule : TsdbTable<entity.Rule>
	{
		public Rule(TsdbDatabase db) : base(db) { }

	};

	public class Output : TsdbTable<entity.Output>
	{
		public Output(TsdbDatabase db) : base(db) { }

	};

	public class Edge : TsdbTable<entity.Edge>
	{
		public Edge(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Edge> _e_id_map = new Dictionary<int, entity.Edge>();
	};

	public class Tree : TsdbTable<entity.Tree>
	{
		public Tree(TsdbDatabase db) : base(db) { }

	};

	public class Decision : TsdbTable<entity.Decision>
	{
		public Decision(TsdbDatabase db) : base(db) { }

	};

	public class Preference : TsdbTable<entity.Preference>
	{
		public Preference(TsdbDatabase db) : base(db) { }

	};

	public class Update : TsdbTable<entity.Update>
	{
		public Update(TsdbDatabase db) : base(db) { }

	};

	public class Fold : TsdbTable<entity.Fold>
	{
		public Fold(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Fold> _f_id_map = new Dictionary<int, entity.Fold>();
	};

	public class Score : TsdbTable<entity.Score>
	{
		public Score(TsdbDatabase db) : base(db) { }

		public Dictionary<int, entity.Score> _score_id_map = new Dictionary<int, entity.Score>();
	};


	//[ContentProperty("Item")]
	//public class ItemTextLoader : m_observable<IActiveObj<entity.Item>, IString>
	//{
	//	public ItemTextLoader(IRtParent parent, IActiveObj<entity.Item> item)
	//		: base(prv, item)
	//	{
	//	}

	//	protected override void start(IActiveObj<entity.Item> arg)
	//	{
	//		arg.Subscribe(itm => _item(new StringItem(itm, itm.Text)), () => _remove_task());
	//	}
	//};


	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	///// <summary>
	///// 
	///// </summary>
	/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
	//public class ItsdbJoinedTable<T> : ListItemBindHelper<T>, IitsdbJoinedTable
	//{
	//    TsdbDatabase db;
	//    String name;
	//    String description;
	//    Type T_item;

	//    public ItsdbJoinedTable(TsdbDatabase db, String name, String description, IEnumerable<T> data)
	//        :base(data)
	//    {
	//        //data.OfType<Object>().ToList()
	//        this.db = db;
	//        this.name = name;
	//        this.description = description;
	//        //this.T_item = this.Count > 0 ? this[0].GetType() : typeof(Object);
	//    }

	//    public string SysObjName
	//    {
	//        get { return name; }
	//    }

	//    public string SysObjDescription
	//    {
	//        get { return description; }
	//    }

	//    public IReadOnlyDictionary<String, ISysObj> SysObjChildren
	//    {
	//        get { return SysObjHelper<ISysObj>.Empty; }
	//    }

	//    public ISysObj SysObjParent
	//    {
	//        get { return db; }
	//    }

	//    public Type ItsdbType
	//    {
	//        get { return T_item; }
	//    }
	//};

}